package com.fingard.dsp.bank.directbank.spdb01;

import com.fingard.dsp.bank.directbank.bankInterface.IContract;
import com.fingard.dsp.bank.reqrespobj.authforrec.ReqAuthForRec;
import com.fingard.dsp.bank.reqrespobj.authforrec.RetAtsAuthForRec;
import com.fingard.dsp.bank.reqrespobj.contract.ReqContract;
import com.fingard.dsp.bank.reqrespobj.contract.ReqQryBatContract;
import com.fingard.dsp.bank.reqrespobj.contract.RetAtsContract;
import com.fingard.dsp.bank.reqrespobj.contract.RetAtsQryBatContract;
import com.fingard.dsp.bank.reqrespobj.contract.detail.RetAtsContractDetail;

public class SPDB01Contract extends SPDB01Base implements IContract {

	@Override
	public RetAtsContract contract(ReqContract p_req) throws Exception {
		RetAtsContract retAts = new RetAtsContract(p_req.reqHeader);
		
		ReqAuthForRec reqForRec = new ReqAuthForRec(p_req);
		SPDB01AuthorizeForRec authClass = new SPDB01AuthorizeForRec();
		authClass.reqHeader = this.reqHeader;
		authClass.bankFront = this.bankFront;
		authClass.setSbLog(this.getSbLog());
		authClass.setLogFlushTime(this.logFlushTime);
		RetAtsAuthForRec resp = authClass.d_auth(reqForRec);
		
		RetAtsContractDetail tmpRetDetail = new RetAtsContractDetail();
		tmpRetDetail.reqSeqID = p_req.contractDetail.askNumber;
		tmpRetDetail.respCode = resp.respCode;
		tmpRetDetail.respInfo = resp.respInfo;
		
		retAts.writeRetDetail(tmpRetDetail);
		return retAts;
	}

    @Override
    public RetAtsContract upContract(ReqContract p_req) throws Exception {
        return null;
    }

    @Override
	public RetAtsContract qryContract(ReqContract p_reqQry) throws Exception {
		return null;
	}

    @Override
    public RetAtsQryBatContract qryBatContract(ReqQryBatContract p_reqQry) throws Exception {
        return null;
    }

}
